package com.breez.aiauth.common.config.handler;

import com.breez.aiauth.common.util.R;
import org.springframework.web.bind.annotation.*;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public R error(Exception e) {
        return R.error(e.getMessage(), 500);
    }

    @ExceptionHandler(AiAuthException.class)
    public R aiAuthException(AiAuthException e) {
        e.printStackTrace(e.getMsg());
        return R.error(e.getMsg(), e.getCode());
    }
}
